#define  _CRT_SECURE_NO_WARNINGS 1

#include "String.h"

namespace GJG
{
	void Test01()
	{
		string s;
		string s1;
		while (cin >> s)
		{
			cout << s << endl;
		}
	}

	void Test02()
	{
		string s;
		cout << s << endl;


		string s1("hello world");
		cout << s1 << endl;

		string s3(s1);
		cout << s3 << endl;

		s = s3;
		cout << s << endl;


		string::iterator it = s1.begin();
		while (it != s1.end())
		{
			cout << *it << " ";
			++it;
		}

		cout << endl << endl;

		for (auto ch : s1)
		{
			cout << ch << " ";
		}

		cout << endl << endl;

		for (size_t i = 0; i < s1.size(); i++)
		{
			cout << s1[i] << " ";
		}
		cout << endl << endl;

		s1.clear();
		cout << "s1 :" << s1 << endl;

		cout << "s3 :" << s3 << endl;

		s3.push_back('x');
		cout << "s3 :" << s3 << endl;

		s3.append("welcom China!");
		cout << "s3 :" << s3 << endl;

		s3.insert(0, 'a');
		cout << "s3 :" << s3 << endl;

		s3.insert(0, "     ");
		cout << "s3 :" << s3 << endl;

		s3 += '&';
		cout << "s3 :" << s3 << endl;

		s3 += "%%%%%%%%%*";
		cout << "s3 :" << s3 << endl;

		/*s3.erase(0);
		cout << "s3 :" << s3 << endl;*/

		/*s3.erase(0, 5);
		cout << "s3 :" << s3 << endl; */

	/*	s3.erase(0, 100);
		cout << "s3 :" << s3 << endl;*/

		/*s3.substr(0,100);
		cout << "s3 :" << s3 << endl;*/


		cout <<"substr:" << s3.substr(0, 10) << endl;
		
	}
}



int main()
{
	GJG::Test02();

	return 0;
}